<?php

if (!defined('BASEPATH'))
	exit('No direct script access allowed');

/*
 * To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
 * Description of category_model
 *
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class Admin_tips_model extends CI_Model {

	//put your code here


	function __construct() {
		parent::__construct();
		log_message('debug', 'Init Model Initialized');
	}

	
	function getTips($status=1) 
	{
		$sql = "select * from tips where status = $status ";
		$query = $this->db->query($sql);
		$result = $query->result();
		return $result;
	}

	function getTipsinfo($id=NULL)
	{
	$sql = "Select * from tips where id= $id ";
	$query = $this->db->query($sql);
	$row = $query->row();
	return $row; 	
	}
	
	function change_tips_status($id, $status) {
		if ($status == 1) {
			$sql = "update tips set status=51 where id=$id";
		}
		if ($status == 51) {
			$sql = "update tips set status=1 where id=$id";
		}
		$this->db->query($sql);
	}
	
	
	function delete($id=NULL)
	{
		$sql="delete from tips where id=$id";
		$this->db->query($sql);
	}
}